#include "DynamicSprite.h"

namespace gaim{

    DynamicSprite::DynamicSprite(const std::map<std::string, Image>& images, const std::string& startingImage,
                const Point2& pos, const Vector2& vel, const int& z) : Sprite(images, startingImage, pos, z), velocity_(vel) {}

    DynamicSprite* DynamicSprite::getInstance(const std::map<std::string, Image>& images,
                                              const std::string& startingImage, const Point2& pos, const int& z){
        return new DynamicSprite(images, startingImage, pos, Vector2(0,0), z);
    }

    void DynamicSprite::update(const std::set<Sprite*>& sprites, const double dt){
        move(velocity_ * dt);
    }

    void DynamicSprite::move(const double x, const double y){
        place(getPos() + Vector2(x, y));
    }

    void DynamicSprite::move(const Vector2& vec){
        place(getPos() + vec);
    }

    void DynamicSprite::setVel(const Vector2& vel){
        velocity_ = vel;
    }
    void DynamicSprite::accelerate(const Vector2& acc){
        velocity_ += acc;
    }

    const Vector2& DynamicSprite::getVel() const{
        return velocity_;
    }

}
